]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
remote-search: require a DesktopId field in search providers
authorCosimo Cecchi <cosimoc@gnome.org>
Thu, 1 Nov 2012 13:50:38 +0000 (09:50 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 6 Nov 2012 22:47:48 +0000 (17:47 -0500)
Remote search providers install an auxiliary keyfile to specify
static information, such as the object path/bus name needed to activate
the binary. Such keyfiles also specify the application the providers
pushes results for; currently, we support two formats for application
information
- two fields, "Title" and "Icon" that specify a (translatable) title and
  an icon name for display
- one field "DesktopId" that specifies the desktop file name of the
  application backing the provider, which obsoletes the previous
  Title/Icon syntax

Since all providers in GNOME use DesktopId now, and we need to ensure a
remote search providers is always backed by an application for future
development, this commit drops the support for the older syntax.

https://bugzilla.gnome.org/show_bug.cgi?id=687491

js/ui/remoteSearch.js

index 35176f4fbadec1653413f6f06dd1abbb4aa1c60f..0625475c8dc6b799d2fb13df9290f43b3de4e348 100644 (file)
@@ -60,7 +60,7 @@ function loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallb
             if (!keyfile.has_group(KEY_FILE_GROUP))
                 continue;
 
-            let remoteProvider, title;
+            let remoteProvider;
             try {
                 let group = KEY_FILE_GROUP;
                 let busName = keyfile.get_string(group, 'BusName');
@@ -74,25 +74,17 @@ function loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallb
                     let desktopId = keyfile.get_string(group, 'DesktopId');
                     appInfo = Gio.DesktopAppInfo.new(desktopId);
                 } catch (e) {
+                    log('Ignoring search provider ' + path + ': missing DesktopId');
+                    continue;
                 }
 
-                let icon;
-                if (appInfo) {
-                    icon = appInfo.get_icon();
-                    title = appInfo.get_name();
-                } else {
-                    let iconName = keyfile.get_string(group, 'Icon');
-                    icon = new Gio.ThemedIcon({ name: iconName });
-                    title = keyfile.get_locale_string(group, 'Title', null);
-                }
-
-                remoteProvider = new RemoteSearchProvider(title,
-                                                          icon,
+                remoteProvider = new RemoteSearchProvider(appInfo.get_name(),
+                                                          appInfo.get_icon(),
                                                           busName,
                                                           objectPath);
                 loadedProviders[objectPath] = remoteProvider;
             } catch(e) {
-                log('Failed to add search provider "%s": %s'.format(title, e.toString()));
+                log('Failed to add search provider %s: %s'.format(path, e.toString()));
                 continue;
             }